package assistant.service;

import assistant.dao.CourseDao;
import assistant.dao.EvaluateDao;
import assistant.dao.StudentCourseDao;
import assistant.dao.WishDao;
import assistant.domain.Course;
import assistant.domain.Evaluate;
import assistant.domain.StudentCourse;
import assistant.domain.Wish;
import utils.DAOFactory;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

/**
 * @Date 2023/1/11 12:32
 * @Author lihu
 */
public class mainFunc {
    public static CourseDao courseDao = DAOFactory.getInstance().getCourseDao();
    public static WishDao wishDao = DAOFactory.getInstance().getWishDao();

    public static EvaluateDao evaluateDao = DAOFactory.getInstance().getEvaluateDao();

    public static StudentCourseDao studentCourseDao = DAOFactory.getInstance().getStudentCourse();

    /**
     * 教师授课
     *
     * @param name
     * @param studentType
     * @param CourseType
     * @param studentNumber
     * @param hour
     * @param term
     * @param year
     * @param teacherId
     */
    public static void teacherInsertCourse(String name, String studentType, Integer CourseType, Integer studentNumber, Integer hour, String term, String year, Long teacherId) {
        Course course = new Course();
        course.setName(name);
        course.setStudentType(studentType);
        course.setCourseType(CourseType);
        course.setStudentNumber(studentNumber);
        course.setHour(hour);
        course.setTerm(term);
        course.setYear(year);
        course.setTeacherId(teacherId);
    }

    /**
     * 获得课程列表
     *
     * @param
     */
    public static List<Course> getCourseList() {
        return courseDao.selectList(null);
    }

    /**
     * 学生填报助教志愿
     *
     * @param courseId
     * @param order
     * @param studentId
     */
    public static void selectCourse(Long studentId, Long courseId, String order) {
        if (Integer.parseInt(order) > 2) {
            System.out.println("志愿只能选择1-2");
        }
        Wish wish = new Wish();
        wish.setCourseId(courseId);
        wish.setOrder(order);
        wish.setStudentId(studentId);
        wishDao.insert(wish);
    }

    /**
     * 评价表
     * @param studentId
     * @param teacherId
     * @param courseId
     * @param result
     * @param finalSelectTime
     * @param selfEvaluate
     * @param teacherEvaluate
     * @param evaluateTime
     */
    public static void  insertEvaluate(Long studentId, Long teacherId, Long courseId,
                                       String result, Date finalSelectTime, String selfEvaluate, String teacherEvaluate, Date evaluateTime) {
        Evaluate evaluate = new Evaluate();
        evaluate.setStudentId(studentId);
        evaluate.setTeacherId(teacherId);
        evaluate.setCourseId(courseId);
        evaluate.setResult(result);
        evaluate.setFinalselectTime(finalSelectTime);
        evaluate.setSelfEvaluate(selfEvaluate);
        evaluate.setTeacherEvaluate(teacherEvaluate);
        evaluate.setEvaluateTime(evaluateTime);
    }


    public static void main(String[] args) {
    }
}
